﻿<UserControl x:Class="Rio.Manager.Application.MainPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:CustomControls="clr-namespace:Rio.Framework.Pages;assembly=Rio.Framework.Pages"
             xmlns:views="clr-namespace:Rio.Manager.Application.Views"
             xmlns:mvvmLightCommand="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:utils="clr-namespace:Rio.Manager.Application.Utils"
             xmlns:MenuOffice="clr-namespace:Rio.Framework.Pages.MenuOffice;assembly=Rio.Framework.Pages"
             mc:Ignorable="d">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <UserControl.DataContext>
        <Binding Path="Main"
                 Source="{StaticResource Locator}" />
    </UserControl.DataContext>

    <Grid x:Name="LayoutRoot"
          Width="Auto"
          Height="Auto">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <mvvmLightCommand:EventToCommand Command="{Binding InitializationCommand}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>

        <Grid.Resources>
            <utils:ViewSelector x:Key="ViewTemplateSelector"
                                AdministrationTabView="{StaticResource AdministrationTabView}"
                                DashboardTabView="{StaticResource DashboardTabView}"
                                FolderTypeAdministrationTabView="{StaticResource FolderTypeAdministrationTabView}"
                                VersioningModelTabView="{StaticResource VersioningModelTabView}"
                                ListUndoCheckOutTabView="{StaticResource ListUndoCheckOutTabView}"
                                GeneralParametersTabView="{StaticResource GeneralParametersTabView}"
                                NewWorkflowTabView="{StaticResource NewWorkflowTabView}"
                                ManageWorkflowTabView="{StaticResource ManageWorkflowTabView}"
                                ManageWorkflowModelTabView="{StaticResource ManageWorkflowModelTabView}"
                                ConnectorTabView="{StaticResource ConnectorTabView}"
                                ConnectorAddTabView="{StaticResource ConnectorAddTabView}"
                                BarCodeTabView="{StaticResource BarCodeTabView}"
                                BarCodeAddTabView="{StaticResource BarCodeAddTabView}"
                                GroupAssociationTabView="{StaticResource GroupAssociationTabView}"
                                GroupSynchronizationTabView="{StaticResource GroupSynchronizationTabView}" />
                                <!--CustomerTabView="{StaticResource CustomerTabView}" />-->
        </Grid.Resources>
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1"
                                 StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <CompositeTransform CenterY="0.5"
                                        CenterX="0.5"
                                        Rotation="135" />
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="White"
                              Offset="0" />
                <GradientStop Color="White"
                              Offset="1" />
                <GradientStop Color="#FF9D9D9D"
                              Offset="0.5" />
            </LinearGradientBrush>
        </Grid.Background>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="50" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <MenuOffice:HeadMenu Name="headMenu" />

        <StackPanel Orientation="Horizontal"
                    Grid.Row="1">

            <Image Margin="5,0,0,0"
                   Source="Assets/Images/RioManager.png" />

            <StackPanel VerticalAlignment="Center"
                        Margin="10,0,0,0">
                <TextBlock TextWrapping="Wrap"
                           Text="{Binding RioManagerTitle, Mode=OneWay}"
                           FontSize="18.667"
                           FontWeight="Bold" />
            </StackPanel>

        </StackPanel>

        <telerik:RadTabControl Grid.Row="2"
                               Margin="0,10,0,0"
                               IsContentPreserved="True"
                               ContentTemplateSelector="{StaticResource ViewTemplateSelector}"
                               ItemsSource="{Binding ViewModelTabItems}"
                               SelectedIndex="{Binding SelectedTab, Mode=TwoWay}"
                               ItemTemplate="{StaticResource TabHeaderTemplate}"
                               Background="#33FFFFFF"
                               BackgroundVisibility="Collapsed" />

        <telerik:RadBusyIndicator Name="busyIndicator"
                                  IsBusy="True"
                                  Grid.RowSpan="3" />
    </Grid>
</UserControl>
